#include "abstract_state.hpp"
#include<stdio.h>
class ToPlay:public StateTransition
{
public:
    ToPlay(boost::shared_ptr<StateNode> anode):StateTransition(anode)
    {

    }

    bool is_complete()
    {
        char a = getchar();
        return a=='y';
    }

    void complete()
    {
        printf("Playing...\n");
        StateTransition::complete();
    }


};

int main(int argc, const char **argv)
{


    boost::shared_ptr<StateNode>idle =  boost::shared_ptr<StateNode>(new StateNode(L"Idle"));
    boost::shared_ptr<StateNode>playing =  boost::shared_ptr<StateNode>(new StateNode(L"Playing"));
    boost::shared_ptr<StateNode>failure =  boost::shared_ptr<StateNode>(new StateNode(L"Failed"));
    boost::shared_ptr<StateNode>stopped =  boost::shared_ptr<StateNode>(new StateNode(L"Stopped"));

    idle->AddLink(playing,boost::shared_ptr<StateTransition>(new ToPlay(playing)));
//
////    idle->AddLink(failure);
////    playing->AddLink(failure);
////    playing->AddLink(stopped);
////    failure->AddLink(stopped);
////    stopped->AddLink(idle);
    StateTransitionController controller;
    StateValue value(L"name",idle.get(),&controller);

    value.start_transition(L"Playing");
    do
    {

    controller.update();
    }while(value.get_current_node_name()!= L"Playing" );


}
